-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add upload to registry workflow for foundry_std #2461
base: master
Are you sure you want to change the base?
Conversation
177666e
to
6e31415
Compare
Blocked by software-mansion/scarb#1605 |
<!-- Reference any GitHub issues resolved by this PR --> Related to #2344 This PR is a part of the stack: --> Add missing info recommended for package uploads (This PR) -- Add github action workflow for automatic registry uploads during release (#2461) ## Introduced changes <!-- A brief description of the changes --> - Adds readmes and links to respective Scarb.tomls, so to view this metadata on the registry and supress scarb warnings - Bump snforge_scarb_plugin version to `0.31.0`, to properly reflect its version in regards to the registry. **From now on all changes made to this crate should be concluded with version bump** ## Checklist <!-- Make sure all of these are complete --> - [X] Linked relevant issue - [X] Updated relevant documentation - [X] Added relevant tests - [X] Performed self-review of the code - [X] Added changes to `CHANGELOG.md` --------- Co-authored-by: Fiiranek <[email protected]> Co-authored-by: Franciszek Job <[email protected]>
This reverts commit da4a5b8.
It needs clarification, but plugins weren't correctly handled by edit: The |
It shouldn't have anything to do with uploading packages though |
working-directory: snforge_std | ||
run: | | ||
../scripts/set_plugin_version.sh | ||
scarb publish --allow-dirty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--allow-dirty
because we modify snforge_std
by executing the script without committing changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not require from tag that triggers the workflow to already include changes introduced by set_plugin_version.sh
? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For development reason, we always would like to have a relative path specified in the dependency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a hard requirement to set the version in snforge only for uploads? What are the downsides of having this set in repo?
it works, tested on dev registry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Partial review, please re-request when ready 👍🏻
# todo: Use scarb stable version that support publishing plugins (after 2.8.4) | ||
scarb-version: "nightly-2024-11-09" | ||
|
||
- name: Check if package version exist in the registry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this step necessary?
We implemented this for publishing Scarb plugins because their version matches the Cairo version. Since multiple Scarb versions can correspond to a single Cairo version, running the workflow with every Scarb release could cause errors by publishing plugins with the same version.
Afaik, this doesn’t apply to snfoundry plugins because their version isn’t tied to any Cairo version. Normally, the workflow should only be triggered once per tag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might decouple foundry plugin version from foundry itself so it might be the case that for consecutive foundry releases, plugin version will stay the same.
So we have to make sure we don't reupload the plugin to the registry in these cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sometimes we patch plugin, without release then we would like to publish it and sometimes we will not do release plugin together with snforge_std and sncast_std, we want to set it on 1.0.0 and keep it until there are changes, and then it would fail the workflow and CI will be red at the release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I pointed out offline, if you're going in the direction of decoupling plugin from foundry itself, it seems to me it a separate workflow should be considered
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is one of the opportunities, but isn't it good enough? @cptartur
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As on how the decoupling will go exactly is yet to be determined. I think the workflow in the current form is okay, and we can introduce changes in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly to @DelevoXDG , I would probably be in favour of splitting release flows for macros and standard libraries as well.
My understanding is that the plugin won't necessarily follow the *_std version, so it may make sense to release it independently. For this manual workflow dispatch only is good enough. Most of logic from this file is fine, though you wouldn't need anything from this step (I mean the check-versions, which I find very hacky) so I'd actually argue it could become far simpler.
Having this, we could probably incorporate *_std upload to the release.yml
workflow, as it seems to me this is more natural place for this. We already verify the version there, so chances are we do not need any further modifications - we could probably just add a new job (standard-libraries-release, or scarbs-release or sth) that will set the plugin version (this is unnecessary if you decide to set the version in Scarb.toml in repo) and use scarb to publish and call it a day. No need to check versions against the registry, verify what should/should not be published etc.
Thoughts?
on: | ||
release: | ||
types: | ||
- published |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think published
will also trigger on creating a draft release which our workflow does. I think it should be released
so it only uploads to registry if we publish a new release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also a concern, in case we ever create a pre-release, do we want to upload to registry as well? Does it support pre-release versions?
cc @maciektr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, it should be changed to released
https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=released#release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, if we want to upload pre-releases as well, let's keep it at published.
# todo: Use scarb stable version that support publishing plugins (after 2.8.4) | ||
scarb-version: "nightly-2024-11-09" | ||
|
||
- name: Check if package version exist in the registry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might decouple foundry plugin version from foundry itself so it might be the case that for consecutive foundry releases, plugin version will stay the same.
So we have to make sure we don't reupload the plugin to the registry in these cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@THenry14 Can you please review as well? I know it's technically your PR but it's changed a bit 😅
on: | ||
release: | ||
types: | ||
- released |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following the discussion from different comment
- released | |
- published |
# todo: Use scarb stable version that support publishing plugins (after 2.8.4) | ||
scarb-version: "nightly-2024-11-09" | ||
|
||
- name: Check if package version exist in the registry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly to @DelevoXDG , I would probably be in favour of splitting release flows for macros and standard libraries as well.
My understanding is that the plugin won't necessarily follow the *_std version, so it may make sense to release it independently. For this manual workflow dispatch only is good enough. Most of logic from this file is fine, though you wouldn't need anything from this step (I mean the check-versions, which I find very hacky) so I'd actually argue it could become far simpler.
Having this, we could probably incorporate *_std upload to the release.yml
workflow, as it seems to me this is more natural place for this. We already verify the version there, so chances are we do not need any further modifications - we could probably just add a new job (standard-libraries-release, or scarbs-release or sth) that will set the plugin version (this is unnecessary if you decide to set the version in Scarb.toml in repo) and use scarb to publish and call it a day. No need to check versions against the registry, verify what should/should not be published etc.
Thoughts?
|
||
PLUGIN_FILE_PATH="../crates/snforge-scarb-plugin/Scarb.toml" | ||
|
||
VERSION=$(cat "$PLUGIN_FILE_PATH" | grep version | cut -d '"' -f 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useless use of cat
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably explains it better
https://en.wikipedia.org/wiki/Cat_(Unix)#Useless_use_of_cat
working-directory: snforge_std | ||
run: | | ||
../scripts/set_plugin_version.sh | ||
scarb publish --allow-dirty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a hard requirement to set the version in snforge only for uploads? What are the downsides of having this set in repo?
Closes #2344
This PR is a part of the stack:
-- Add missing info recommended for package uploads (#2460)
--> Add github action workflow for automatic registry uploads during release (This PR)
Introduced changes
Checklist
CHANGELOG.md